package com.example.palette.start;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class StartTaskCacher {

    private static StartTaskCacher mInstance;
    private Map<Class<? extends IStartTask>,StartTaskResult> results = new ConcurrentHashMap();

    public static StartTaskCacher getInstance(){
        if(mInstance == null){
            synchronized (StartTaskCacher.class){
                if(mInstance == null){
                    mInstance = new StartTaskCacher();
                }
            }
        }
        return mInstance;
    }

    public void save(Class<? extends IStartTask> clazz,StartTaskResult result){
        results.put(clazz, result);
    }

    public <T> StartTaskResult<T> get(Class<? extends IStartTask> clazz){
        return results.get(clazz);
    }
}
